@import '@/styles/utils.scss';

.left {
    display: flex;
    align-items: center;
}

.dropdownTrigger {
    display: flex;
    align-items: center;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background-color 0.2s;

    &:hover {
        background-color: rgba(0, 0, 0, 0.05);
    }

    &:focus {
        outline: none;
    }
}

.modelName {
    color: #151515;
    font-size: 14px;
    font-weight: 500;
    margin-right: 8px;
    padding: 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 210px;

    :global(.dark) & {
        color: #f5f5f5;
    }
}

.dropdownArrow {
    margin-top: 1px;
    font-size: 10px;
    opacity: 0.6;
    transition: transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dropdownArrowOpen {
    transform: rotate(180deg);
}

.dropdownMenuContent {
    animation: slideIn 0.2s ease-out;
    min-width: 156px;
    background-color: white;
    border-radius: 8px;
    padding: 5px;
    box-shadow: 0px 10px 38px -10px rgba(22, 23, 24, 0.35), 0px 10px 20px -15px rgba(22, 23, 24, 0.2);
    animation-duration: 400ms;
    animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform, opacity;

    :global(.dark) & {
        background-color: #48494C;
        box-shadow: none;
    }
}

.dropdownMenuItem {
    display: flex;
    align-items: center;
    height: 32px;
    padding: 0 10px;
    border-radius: 8px;
    position: relative;
    user-select: none;
    outline: none;
    cursor: pointer;
    color: #353535;
    transition: background-color 0.2s ease;
    line-height: 1;
    margin-bottom: 8px;

    &:hover {
        background-color: rgba(0, 0, 0, 0.05);
    }

    &:focus {
        background-color: rgba(0, 0, 0, 0.05);
    }

    :global(.dark) & {
        color: #f5f5f5;

        &:hover,
        &:focus {
            background-color: rgba(255, 255, 255, 0.1);
        }
    }

    i{
        margin-right: 10px;
        font-size: 15px;
        width: 16px;
        color: #151515;
        :global(.dark) & {
            color: #f5f5f5;
        }
    }

    .star2{
        color: #FF8D00 !important;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


// Dialog styles
.dialogOverlay {
    background-color: rgba(0, 0, 0, 0.4);
    position: fixed;
    inset: 0;
    animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(4px);
    z-index: 999;
  }
  
  .dialogContent {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0px 10px 38px -10px rgba(22, 23, 24, 0.35), 0px 10px 20px -15px rgba(22, 23, 24, 0.2);
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90vw;
    max-width: 552px;
    max-height: 85vh;
    padding: 20px;
    animation: contentShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000;
  
    :global(.dark) & {
      background: #1F2023;
      color: #e5e7eb;
    }
  }
  
  // 插件详情弹窗样式
  .pluginDetailsContent {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0px 10px 38px -10px rgba(22, 23, 24, 0.35), 0px 10px 20px -15px rgba(22, 23, 24, 0.2);
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90vw;
    max-width: 600px;
    max-height: 85vh;
    padding: 0;
    animation: contentShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  
    :global(.dark) & {
      background-color: #1f1f1f;
      color: #e5e7eb;
    }
  }
  
  .pluginDetailsHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
  
    :global(.dark) & {
      border-color: #333;
    }
  }
  
  .pluginDetailsTitle {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
  
    :global(.dark) & {
      color: #ffffff;
    }
  }
  
  .pluginDetailsTabs {
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid #e5e7eb;
    position: relative;
  
    :global(.dark) & {
      border-color: #333;
    }
  }
  
  .pluginDetailsTab {
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    position: relative;
  
    &.active {
      color: #000;
  
      &::after {
        content: '';
        position: absolute;
        bottom: -1px;
        left: 0;
        width: 100%;
        height: 2px;
        background-color: #000;
      }
  
      :global(.dark) & {
        color: #fff;
  
        &::after {
          background-color: #fff;
        }
      }
    }
  
    :global(.dark) & {
      color: #9ca3af;
    }
  }
  
  .viewSourceButton {
    margin-left: auto;
    padding: 4px 10px;
    font-size: 13px;
    color: #3b82f6;
    cursor: pointer;
  
    &:hover {
      text-decoration: underline;
    }
  
    :global(.dark) & {
      color: #60a5fa;
    }
  }
  
  .pluginDetailsBody {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    max-height: 400px;
  }
  
  .aboutContent {
    font-size: 14px;
    line-height: 1.5;
    color: #374151;
  
    :global(.dark) & {
      color: #d1d5db;
    }
  }
  
  .pluginDescription {
    margin-top: 0;
    margin-bottom: 20px;
  }
  
  .featuresTitle {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #111827;
  
    :global(.dark) & {
      color: #f9fafb;
    }
  }
  
  .featuresList {
    margin: 0;
    padding-left: 20px;
  
    li {
      margin-bottom: 8px;
    }
  }
  
  .pluginDetailsFooter {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
  
    :global(.dark) & {
      border-color: #333;
    }
  }
  
  .deletePluginButton {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    background-color: transparent;
    color: #ef4444;
    border: 1px solid #ef4444;
    cursor: pointer;
  
    &:hover {
      background-color: rgba(239, 68, 68, 0.05);
    }
  
    :global(.dark) & {
      color: #f87171;
      border-color: #f87171;
  
      &:hover {
        background-color: rgba(248, 113, 113, 0.1);
      }
    }
  }
  
  .editPluginButton {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    background-color: #000;
    color: white;
    border: none;
    cursor: pointer;
  
    &:hover {
      background-color: #1a1a1a;
    }
  
    :global(.dark) & {
      background-color: #3b82f6;
  
      &:hover {
        background-color: #2563eb;
      }
    }
  }
  
  .dialogHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
  }
  
  .dialogTitle {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
  
    :global(.dark) & {
      color: #ffffff;
    }
  }
  
  .closeButton {
    background: transparent;
    border: none;
    padding: 5px;
    cursor: pointer;
    color: #151515;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
  
    &:hover {
      background: #F3F3F3;
    }
  
    :global(.dark) & {
      color: #fff;
  
      &:hover {
        background: #313234;
        color: #fff;
      }
    }
  }
  
  .content {
    overflow-y: auto;
  }
  
  .formGroup {
    margin-bottom: 24px;
  
    &.switchGroup {
      display: flex;
      justify-content: space-between;
      align-items: center;
  
      .formLabel {
        margin-bottom: 0;
      }
  
      .switchRoot {
        width: 36px;
        height: 20px;
        background-color: rgba(0, 0, 0, 0.1);
        border-radius: 10px;
        position: relative;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
        display: flex;
        align-items: center;
  
        &[data-state='checked'] {
          // background: linear-gradient(138deg, #6846F4 0%, #004DFF 39%, #00C4DE 76%, #52CE73 100%);
          background: #1ED760;
        }
  
        :global(.dark) & {
          background-color: rgba(255, 255, 255, 0.1);
        }
      }
  
      .switchThumb {
        display: block;
        width: 16px;
        height: 16px;
        background-color: white;
        border-radius: 50%;
        box-shadow: 0 2px 2px rgba(0, 0, 0, 0.1);
        transition: transform 100ms;
        transform: translateX(2px);
        will-change: transform;
        margin: 0 2px;
  
        &[data-state='checked'] {
          transform: translateX(16px);
        }
      }
    }
  }
  
  .formLabel {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: #374151;
  
    :global(.dark) & {
      color: #d1d5db;
    }
  }
  
  .formInput {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    background-color: #fff;
    line-height: 1;
  
    &:focus {
      border-color: #3b82f6;
      box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
    }
  
    &::placeholder {
      color: #9ca3af;
    }
  
    :global(.dark) & {
      background-color: #2E3033;
      border-color: #3F4245;
      color: #e5e7eb;
  
      &::placeholder {
        color: #6b7280;
      }
  
      &:focus {
        border-color: #60a5fa;
        box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.1);
      }
    }
  }
  
  .jsonTextarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    background-color: #fff;

    resize: vertical;
  
    &:focus {
      border-color: #3b82f6;
      box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
    }
  
    &::placeholder {
      color: #9ca3af;
    }
  
    :global(.dark) & {
      background-color: #2E3033;
      border-color: #4b5563;
      color: #e5e7eb;
  
      &::placeholder {
        color: #6b7280;
      }
  
      &:focus {
        border-color: #60a5fa;
        box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.1);
      }
    }
  }
  
  .variableRow {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
  }
  
  .addVariableButton,
  .addArgumentButton {
    width: 132px;
    height: 32px;
    // padding: 6px 15px;
    background: linear-gradient(180deg, #FFFFFF 0%, #EEF0F4 100%);
    border-radius: 8px;
    border: 1px solid #D6DBE5;
    font-size: 16px;
    color: #353535;
    text-align: center;
    margin-right: 10px;
    &:hover {
      // text-decoration: underline;
      box-shadow: 0px 0px 10px 0px rgba(221, 221, 221, 0.5); ;
    }
  
    :global(.dark) & {
      color: #60a5fa;
    }
  }
  
  .jsonModeLink {
    text-align: right;
    color: #3b82f6;
    font-size: 13px;
    cursor: pointer;
    margin-bottom: 20px;
    font-weight: 500;
  
    &:hover {
      text-decoration: underline;
    }
  
    :global(.dark) & {
      color: #60a5fa;
    }
  }
  
  .dialogFooter {
    display: flex;
    justify-content: flex-end;
    gap: 24px;
    // margin-top: 24px;
    padding-top: 16px;
  }
  
  .cancelButton {
    flex: 1;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    background: #E8E8E8;
    color: #6b7280;
    // border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.3s;
    height: 40px;

    &:hover {
      background: #EEF0F4;
    }
  
    :global(.dark) & {
      border: 1px solid #3F4245;
      background: #1F2023;
      color: #fff;

      &:hover {
        background: #313234;
        border: 1px solid #3F4245;
      }
    }
  }
  
  .addButton {
    flex: 1;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    background: #151515;
    color: white;
    border: none;
    cursor: pointer;
    border:1px solid transparent;
    transition: all 0.3s;
    height: 40px;

    &:hover {
      background: #353535;
    }
  
    :global(.dark) & {
      border: 1px solid #3F4245;
      background: #1F2023;
      color: #fff;

      &:hover {
        background: #313234;
        border: 1px solid #3F4245;
      }
    }
  }
  
  @keyframes overlayShow {
    from {
      opacity: 0;
    }
  
    to {
      opacity: 1;
    }
  }
  
  @keyframes contentShow {
    from {
      opacity: 0;
      transform: translate(-50%, -48%) scale(0.96);
    }
  
    to {
      opacity: 1;
      transform: translate(-50%, -50%) scale(1);
    }
  }